package pack3;

public class test6 {
    public static void main(String[] args) {
        Shape[] shapes = {
                new Rectangle(0, 0, 5, 3),
                new Circle(0, 0, 2),
                new Cylinder(0, 0, 1, 4)
        };
        double totalArea = 0;
        for (Shape shape : shapes) {
            totalArea += shape.calculateArea();
            shape.show();
        }
        System.out.println("总面积: " + totalArea);
    }
}
